﻿using AutoMapper;
using MediatR;
using S.EarTag.API.Application.MediatorCommand.BreedingWeighCommand;
using S.EarTag.Infrastructure.Repository.Impl.EarTagRepository;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Application.MediatorCommandHandler.BreedingWeighCommandHandler
{
    //删除
    public class DeletedBreedingCommandHandler : IRequestHandler<DeletedBreedingCommand, bool>
    {
        private readonly IBreedingWeighRepository db;

        public DeletedBreedingCommandHandler(IBreedingWeighRepository db)
        {
            this.db = db;
        }
        public async Task<bool> Handle(DeletedBreedingCommand request, CancellationToken cancellationToken)
        {
            return await db.DeleteAsync(request.BreedingID);
        }

    }
}
